<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用戶管理</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/bootstrap-select.css}">
    <link th:href="@{/bootstrap/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/zlupdate.css}" rel="stylesheet">
    <script th:src="@{/js/jquery-1.9.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/bootstrap-select.js}">
    </script>
    <script type="text/javascript" th:src="@{/bootstrap/bootstrap.min.js}"></script>
    <script type="text/javascript">
        document.addEventListener("DOMContentLoaded", function () {
            $('.selectpicker').selectpicker({
                'selectedText': 'cat'
            });
        });
        // document.addEventListener("DOMContentLoaded", function () {
        //     document.body.style.display = "block";
        // });
        $(document).ready(function () {
            $(".b").fadeIn(600)
        });
    </script>
</head>
<body class="b" style="font-size: 16px;background-color: #f9f9f9">
<form style="text-align: center;margin-top: 5%" method="post" enctype="multipart/form-data" action="/admin/admin/userPost">
    <input name="userId" hidden th:if="${account}" type="text" th:value="${account.userId}">
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%"><b>
            <input disabled style="background-color: transparent;border: 0"
                   type="text"
                   value="用户名:"/>
        </b></div>
        <div th:unless="${account}" class="col-sm-8">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="userName"
                   required
                   placeholder="必填"/>
        </div>
        <div th:if="${account}" class="col-sm-8">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="userName"
                   required
                   placeholder="必填" th:value="${account.userName}"/>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%"><b><input disabled style="background-color: transparent;border: 0"
                                                               type="text"
                                                               value="请输入密码:"/></b></div>
        <div th:unless="${account}" class="col-sm-8">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="password"
                   required
                   placeholder="必填"/>
        </div>
        <div th:if="${account}" class="col-sm-8">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="password"
                   required
                   placeholder="必填" th:value="${account.password}"/>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%">
            <b>
                <input disabled style="background-color: transparent;border: 0" type="text" value="请选择角色属性:"/>
            </b>
        </div>
        <div class="col-sm-8" style="margin-top: 1%" th:if="${account}">
            <select name="roleName" id="id_select" class="selectpicker bla bla bli"
                    data-live-search="true">
                <!--<option style="height: 20px"></option>-->
                <option style="height: 20px" th:selected="${account.roleId} eq '1'">管理员</option>
                <option style="height: 20px" th:selected="${account.roleId} eq '2'">编辑人员</option>
                <option style="height: 20px" th:selected="${account.roleId} eq '3'">普通用户</option>
                <option style="height: 20px" th:selected="${account.roleId} eq '4'">审核人员</option>
            </select>
        </div>
        <div class="col-sm-8" style="margin-top: 1%" th:unless="${account}">
            <select name="roleName" id="id_select" class="selectpicker bla bla bli"
                    data-live-search="true">
                <!--<option style="height: 20px"></option>-->
                <option style="height: 20px">管理员</option>
                <option style="height: 20px">编辑人员</option>
                <option style="height: 20px">普通用户</option>
                <option style="height: 20px">审核人员</option>
            </select>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%"><b><input disabled style="background-color: transparent;border: 0"
                                                               type="text"
                                                               value="请输入邮箱:"/></b></div>
        <div class="col-sm-8" th:if="${account}">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="email"
                   placeholder="请输入邮箱" th:value="${account.email}"/>
        </div>
        <div class="col-sm-8" th:unless="${account}">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="email"
                   placeholder="请输入邮箱"/>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%"><b><input disabled style="background-color: transparent;border: 0"
                                                               type="email"
                                                               value="请输入电话:"/></b></div>
        <div class="col-sm-8" th:if="${account}">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="telephon"
                   placeholder="请输入电话" th:value="${account.telephon}"/>
        </div>
        <div class="col-sm-8" th:unless="${account}">
            <input style="margin-top: 5px;margin-bottom: 5px" class="form-control" type="text" name="telephon"
                   placeholder="请输入电话"/>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%"><b><input disabled style="background-color: transparent;border: 0"
                                                               type="text"
                                                               value="请选择权限范围:"/></b></div>
        <div class="col-sm-8" style="margin-top: 5px;margin-bottom: 5px">
            <select name="dcs" id="id_select" class="selectpicker bla bla bli"
                    multiple data-live-search="true">
                <div th:each="cate:${categorys}" th:if="${account}">
                    <option th:text="${cate.key}" th:selected="${cate.value} eq '1'"></option>
                </div>
                <div th:each="cate:${categorys}" th:unless="${account}">
                    <option th:text="${cate.key}"></option>
                </div>
            </select>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="col-sm-3" style="margin-top: 1%">
            <b>
                <input disabled style="background-color: transparent;border: 0" type="text" value="账号状态:"/>
            </b>
        </div>
        <div class="col-sm-8" style="margin-top: 1%" th:if="${account}">
            <select name="status" id="status" class="selectpicker bla bla bli"
                    data-live-search="true">
                <!--<option style="height: 20px"></option>-->
                <option style="height: 20px" th:selected="${account.status} " value="false">停用</option>
                <option style="height: 20px" th:selected="${account.status}" value="true">启用</option>
            </select>
        </div>
        <div class="col-sm-8" style="margin-top: 1%" th:unless="${account}">
            <select name="status" id="status" class="selectpicker bla bla bli"
                    data-live-search="true">
                <!--<option style="height: 20px"></option>-->
                <option style="height: 20px" value="false">停用</option>
                <option style="height: 20px" value="true">启用</option>
            </select>
        </div>
    </div>
    <div style="margin-top: 2%;text-align: center" class="col-sm-11">
        <!--<input style="border-radius:3px;width: 15%" type="button" onclick="javascript:history.go(-1)" value="返回上一页"/>-->
        <input style="border-radius:3px;width: 15%" type="button"
               th:onclick="|javascript:goHome('/admin/admin/usersget/1/10')|" value="取消"/>
        <input style="border-radius:3px;width: 15%" type="submit" value="保存"/>
    </div>
</form>
<script>
    function goHome(url) {
        window.location.replace(url)
    };
</script>
</body>
</html>